<template>
	<!-- 我的下级 -->
	<view class="dataLower">
		<view class="dataLower_header">
			<view class="dataSearch">
				<u-search placeholder="搜索AID" v-model="keyword" shape="square" @custom="getDatacenter"></u-search>
			</view>
			<view class="datadate">
				<view class="content_date">
					<view class="date_sw">
						<view :class="dateIndex==0?'target':''" @click="dateSw(0);">昨日</view>
						<view :class="dateIndex==1?'target':''" @click="dateSw(1);">近7日</view>
						<view :class="dateIndex==2?'target':''" @click="dateSw(2);">近30日</view>
					</view>
				</view>
			</view>
		</view>
		<view class="contentModule contentZl">
			<view class="module_list" v-for="(item,index) in dataCenterData">
				<view class="module_listinc">
					<view class="module_listtop">
						<text>{{item.agencyinfo.realname}}AID{{item.agencyinfo.aid}}</text>
					</view>
					<view class="zl_listcon">
						<view class="zl_listeve">
							<view class="zl_listval">{{item.datalist.newshop.basic_shop.new_num}}<text>户</text></view>
							<view class="zl_listname">新增支付门店</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{item.datalist.newshop.waimai_shop.new_num}}<text>户</text></view>
							<view class="zl_listname">新增外卖门店</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{item.datalist.newusers.new.num}}/{{item.datalist.newusers.conversion.num}}<text>人</text></view>
							<view class="zl_listname">新增/转化用户</view>
						</view>
					</view>
					<view class="zl_listcon">
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(item.datalist.payorders.num).taika_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(item.datalist.payorders.payment).taika_money}}</view>
							<view class="zl_listname">台卡订单</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(item.datalist.payorders.num).tangshi_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(item.datalist.payorders.payment).tangshi_money}}</view>
							<view class="zl_listname">扫码点餐</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(item.datalist.payorders.num).scan_qr_buy_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(item.datalist.payorders.payment).scan_qr_buy_money}}</view>
							<view class="zl_listname">扫码购</view>
						</view>
					</view>
					<view class="zl_listcon">
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(item.datalist.waimaiorders.num).self_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(item.datalist.waimaiorders.payment).self_payment}}</view>
							<view class="zl_listname">外卖自取</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(item.datalist.waimaiorders.num).shop_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(item.datalist.waimaiorders.payment).shop_payment}}</view>
							<view class="zl_listname">外卖自配送</view>
						</view>
						<view class="zl_listeve">
							<view class="zl_listval">{{isEmpty(item.datalist.waimaiorders.num).platform_num}}<text>笔</text></view>
							<view class="zl_listval">{{isEmpty(item.datalist.waimaiorders.payment).platform_payment}}</view>
							<view class="zl_listname">外卖平台配送</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import { datacenter } from '../../api/index.js'
	export default {
		data() {
			return {
				aid:'',
				keyword:'',
				dateIndex:0,
				dataCenterData:'',
				timeStatus:{
					'0':'2',
					'1':'3',
					'2':'4'
				}
			}
		},
		onLoad:function(){
			this.aid = this.$storage('global').getItemSync('loginInfo').aid;
			this.getDatacenter();
		},
		methods: {
			dateSw:function(index){
				this.dateIndex = index;
				this.getDatacenter();
			},
			getDatacenter:function(){
				datacenter({
					aid:this.aid,
					data_type:6,
					seachtime:this.timeStatus[this.dateIndex],  //时间
					search_aid:this.keyword  //下级aid
				}).then((res)=>{
					console.log(res)
					this.dataCenterData = res.data;
				})
			},
			isEmpty:function(num){
				return num?num:{}
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '../../components/data/datamodule.scss';
	.dataLower{
		.dataLower_header{
			.dataSearch{
				padding: 0 30rpx;
			}
		}
	}
	.content_date{
		justify-content: space-around;
	}
</style>
